package ddemo.service;





import ddemo.factory.MapperProxyFactory;
import ddemo.dao.UserMapper;
import ddemo.pojo.Ask;
import ddemo.pojo.Charger;
import ddemo.pojo.Interface;
import ddemo.pojo.User;

import java.util.List;


public class UserService {
    private static UserMapper userMapper = MapperProxyFactory.getMapper(UserMapper.class);
    public static User login(String username, String password){
        User user=userMapper.getUser(username, password);
        //System.out.println(user.getUsername());
        return user;
    }
    public static boolean isHave(String username){
        User user=userMapper.checkUser(username);
        if(user==null){
            return true;
        }
        else{
            return false;
        }
    }
    public static int register(String username, String password,String phone_number){
        int num=userMapper.insertUser(username, password,1,"0",phone_number);
        return num;
    }
    public static int ecRegister(String ev,Integer id) {
        int num = userMapper.evResiter(ev, id);
        return num;

    }




}
